/**
 * @addtogroup gbc_msg_17691
 * gb_17691_msg_sd
 * @brief        廊坊地标消息
 * @par 示例
 * @code
   // 包含国六廊坊地标扩展的消息
   // 防篡改备案消息中的芯片ID和正式公钥通过加密接口IGbc17691Encrypt获得
   // 消息中时间格式为byte形式
   //参考 gbc_17691_msg_gb.h的使用示例

 * @endcode
 * @{
 */
/**
 * @file         gbc_17691_msg_lf.h
 * @brief        廊坊地标消息
 * @note         
 * @author       Dengdeshou
 * @date         2020-08-07
 * @version      1.0
 *
 * @par          修改日志
 * <table>
 * <tr><th>Date        <th>Version               <th>Author          <th>Description
 * <tr><td>2020-08-19  <td>1.0                   <td>Dengdeshou      <td>创建初始版本
 * @copyright    杭州鸿泉物联网技术股份有限公司
 */
#ifndef _SCC_PT17691_MSG_LF_H_
#define _SCC_PT17691_MSG_LF_H_

#include "ofc/ofc_object.h"
#include "ofc/ofc_list.h"
#include "mfc/mfc_string.h"
#include "gbmsg17691/gbc_17691_msg.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * 廊坊地标命令字
 */
typedef enum TGbc17691CmdLfEnumTag TGbc17691CmdLfEnum;
enum TGbc17691CmdLfEnumTag
{
    // 廊坊扩增指令
    kGbc17691CmdLfBreakAlarmReq = 0x06, ///< 防拆报警上报 +
    kGbc17691CmdLfAcquiringReq = 0x07,   ///< 备案信息上报 + 
    kGbc17691CmdLfAcquiringAck = 0x08,   ///< 备案信息应答 +
    kGbc17691CmdLfStreamAck = 0xf0,      ///< 信息流应答 + 
    kGbc17691CmdLfLoginAck  = 0xc0,      ///< 登入信息应答 +
    kGbc17691CmdLfCheckTimeAck  = 0xc1,  ///< 终端校时应答 +
};
/**
 * 车辆拆除报警信息(cmd = 0x06)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfBreakAlarmTag TGbc17691MsgLfBreakAlarm;
struct TGbc17691MsgLfBreakAlarmTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 logout_time[6];               ///< 登出时间 
    UInt16 logout_seqid;                ///< 流水号
    UInt8 location_state;               ///< 定位状态           
    UInt32 longitude;                   ///< 经度
    UInt32 latitude;                    ///< 纬度
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfBreakAlarmCreate(TGbc17691MsgLfBreakAlarm *self);

/**
 * 数据防篡改备案(cmd = 0x07)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfAcquiringTag TGbc17691MsgLfAcquiring;
struct TGbc17691MsgLfAcquiringTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 collect_time[6];              ///< 数据采集时间 
    UInt8 chip_id[16];                  ///< 芯片ID
    UInt8 public_key[64];               ///< 公钥           
    UInt8 vin[17];                      ///< VIN 17字节          
    TGbc17691Signature signature;       ///< 数字签名
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfAcquiringCreate(TGbc17691MsgLfAcquiring *self);

/**
 * 备案状态
 */
enum TGbc17691LfAcquiringResultEnumTag
{
    kGbc17691AcquiringResultSuccess = 1,   ///< 备案成功
    kGbc17691AcquiringResultFail = 2,     ///< 备案失败
};
typedef enum TGbc17691LfAcquiringResultEnumTag TGbc17691LfAcquiringResultEnum;

/**
 * 备案信息
 */
enum TGbc17691LfAcquiringInfoEnumTag
{
    kGbc17691LfAcquiringInfoSucess = 0,      ///< 备案成功
    kGbc17691LfAcquiringInfoChipError = 1, ///< 芯片ID不符
    kGbc17691LfAcquiringInfoVinError = 2,    ///< VIN错误
    kGbc17691LfAcquiringInfoDevVinNull = 3,    ///< 设备获取 VIN 为空
    kGbc17691LfAcquiringInfoAcqVinNull = 4,    ///< 备案 VIN 为空
    kGbc17691LfAcquiringInfoDevAlready = 5,    ///< 设备已经进行过备案
    kGbc17691LfAcquiringInfoCannotSave = 6,    ///< 备案数据保存失败
    kGbc17691LfAcquiringInfoSigFail    = 7,    ///< 验签失败
};
typedef enum TGbc17691LfAcquiringInfoEnumTag TGbc17691LfAcquiringInfoEnum;
/**
 * 备案结果应答(cmd = 0x08)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfAcquiringAckTag TGbc17691MsgLfAcquiringAck;
struct TGbc17691MsgLfAcquiringAckTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 record_state;                   ///< 状态码,参考 TGbc17691LfAcquiringResultEnum
    UInt8 record_info;                    ///< 信息，参考 TGbc17691LfAcquiringInfoEnum
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfAcquiringAckCreate(TGbc17691MsgLfAcquiringAck *self);

/**
 * 登入结果
 */
enum TGbc17691LfResultEnumTag
{
    kGbc17691LfResultSuccess = 1,      ///< 成功
    kGbc17691LfResultFail = 2,        ///< 失败
};
typedef enum TGbc17691LfResultEnumTag TGbc17691LfResultEnum;

/**
 * 登入平台结果应答(cmd = 0xC0)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfLoginAckTag TGbc17691MsgLfLoginAck;
struct TGbc17691MsgLfLoginAckTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt16 login_seq_id;                ///< 登入流水号
    UInt8 login_result;                 ///< 登入结果,参考 TGbc17691LfResultEnum
    UInt8 sm2_public_key[64];           ///< 非对称加密公钥
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfLoginAckCreate(TGbc17691MsgLfLoginAck *self);

/**
 * 数据流状态码
 */
enum TGbc17691LfStreamStatusEnumTag
{
    kGbc17691LfStreamStatusSuccess = 0,      ///< 成功
    kGbc17691LfStreamStatusError   = 1,      ///< 数据格式错误
};
typedef enum TGbc17691LfStreamStatusEnumTag TGbc17691LfStreamStatusEnum;

/**
 * 实时信息上报应答结果应答(cmd = 0xF0)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfStreamAckTag TGbc17691MsgLfStreamAck;
struct TGbc17691MsgLfStreamAckTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt16 seq_id;                      ///< 流水号与实时信息上报流水号相同
    UInt8 report_result;                ///< 上报信息应答,参考 TGbc17691LfResultEnum
    UInt8 status;                       ///< 状态码 TGbc17691LfStreamStatusEnum
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfStreamAckCreate(TGbc17691MsgLfStreamAck *self);

/**
 * 地方平台校时请求应答(cmd = 0x05)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfCheckTimeTag TGbc17691MsgLfCheckTime;
struct TGbc17691MsgLfCheckTimeTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt16 seq_id;      ///< 校时请求流水号
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfCheckTimeCreate(TGbc17691MsgLfCheckTime *self);


/**
 * 地方平台校时应答(cmd = 0xC1)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLfCheckTimeAckTag TGbc17691MsgLfCheckTimeAck;
struct TGbc17691MsgLfCheckTimeAckTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt16 seq_id;      ///< 以天为单位，流水号与校时请求流水号相同
    UInt8  time[6];     ///< 平台的当前时间，符合 GMT+8 的时间格式 YYYY/MM/DD hh:mm:ss
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLfCheckTimeAckCreate(TGbc17691MsgLfCheckTimeAck *self);

#ifdef __cplusplus
}
#endif

#endif

/**
 * @} 
 */
